


#ifndef PF_OVERLAYBOX_H
#define PF_OVERLAYBOX_H

#include "pf_atomicentity.h"
#include "lx_Export.h"

/**
 * Holds the data that defines a line.
 */
class LX_EXPORT PF_OverlayBoxAttribute {
public:
    /**
     * Default constructor. Leaves the data object uninitialized.
     */
    PF_OverlayBoxAttribute() {}

    PF_OverlayBoxAttribute(const PF_Vector& corner1, const PF_Vector& corner2) {

        this->corner1 = corner1;
        this->corner2 = corner2;
    }

    friend class PF_OverlayBox;

    friend std::ostream& operator << (std::ostream& os, const PF_OverlayBoxAttribute& ld) {
        os << "(" << ld.corner1 <<
        "/" << ld.corner2 <<
        ")";
        return os;
    }

public:
    PF_Vector corner1;
    PF_Vector corner2;
};


/**
 * Class for a line entity.
 */
class LX_EXPORT PF_OverlayBox : public PF_AtomicEntity {
public:
    PF_OverlayBox(PF_Container* parent, const PF_OverlayBoxAttribute& d);
    virtual PF_Entity* clone();
    virtual ~PF_OverlayBox();

    /**	@return LX_Define::EntityLine */
    virtual LX_Define::EntityType rtti() const {
        return LX_Define::EntityOverlayBox;
    }
    virtual void draw(PF_Painter* painter, PF_GraphicView* view, double patternOffset=0.0);

	/** @return Start point of the entity */
    virtual PF_Vector getCorner1() const {
        return data.corner1;
    }
    /** @return End point of the entity */
    virtual PF_Vector getCorner2() const {
        return data.corner2;
    }
	/** @return Copy of data that defines the line. */
    PF_OverlayBoxAttribute getData() const {
        return data;
    }
	
	/** We should make a seperate drawing meganism for overlays and not use entities */
	virtual void move(PF_Vector offset){}
    virtual void rotate(PF_Vector center, double angle){}
    virtual void scale(PF_Vector center, PF_Vector factor){}
    virtual void mirror(PF_Vector axisPoint1, PF_Vector axisPoint2){}
	virtual void calculateBorders(){}
	virtual PF_Vector getNearestEndpoint(const PF_Vector&, double*){return PF_Vector();}
	virtual PF_Vector getNearestPointOnEntity(const PF_Vector&, bool, double*, PF_Entity**){return PF_Vector();}
	virtual PF_Vector getNearestCenter(const PF_Vector&, double*){return PF_Vector();}
	virtual PF_Vector getNearestMiddle(const PF_Vector&, double*){return PF_Vector();}
	virtual PF_Vector getNearestDist(double, const PF_Vector&, double*){return PF_Vector();}
	virtual double getDistanceToPoint(const PF_Vector&, PF_Entity**, LX_Define::ResolveLevel, double){return -1;}
	
protected:
    PF_OverlayBoxAttribute data;
}
;

#endif
